import request from '@/utils/request'

// 查询主设备列表
export function listMainDevice(query) {
  return request({
    url: '/genius/platform-device/list',
    method: 'get',
    params: query
  })
}

// 根据projectIds查询主设备列表
export function listMainDeviceByProjectIds(query) {
  return request({
    url: '/genius/platform-device/get-by-project-ids',
    method: 'get',
    params: query
  })
}

// 查询主设备详情
export function getMainDeviceDetail(id) {
  return request({
    url: '/genius/platform-device/' + id,
    method: 'get'
  })
}

// 新增主设备
export function addMainDevice(data) {
  return request({
    url: '/genius/platform-device',
    method: 'post',
    data: data
  })
}

// 修改主设备
export function updateMainDevice(data) {
  return request({
    url: '/genius/platform-device',
    method: 'put',
    data: data
  })
}
// 导出主设备
export function exportMainDevice(data) {
  return request({
    url: '/genius/platform-device/export',
    method: 'post',
    data: data
  })
}

// 逻辑删除主设备信息
export function delMainDevice(ids) {
  return request({
    url: '/genius/platform-device/' + ids   ,
    method: 'delete'
  })
}

// 激活主设备
export function deployMainDevice(data) {
  return request({
    url: '/genius/platform-device/deploy',
    method: 'post',
    data: data
  })
}

// 禁用主设备
export function unDeployMainDevice(data) {
  return request({
    url: '/genius/platform-device/unDeploy',
    method: 'post',
    data: data
  })
}

// 主设备注册IOT平台
export function registryIot(data) {
  return request({
    url: '/genius/platform-device/registry-iot',
    method: 'post',
    data: data
  })
}

// 批量导入设备
export function batchInsert(data) {
  return request({
    url: '/genius/platform-device/batch-insert',
    method: 'post',
    data: data
  })
}
